<?php defined('BASEPATH') OR exit('No direct script access allowed');?>


<!-- +++++ Contact Section +++++ -->
<div class="pink">
<div class="container">
    <div class="row">
        <div class="col-lg-6 col-lg-offset-3 centered">
            <h3>联系我</h3>
            <hr>
            <p>欢迎反馈bug，如果没有，我们也可以从诗词歌赋谈到人生理想 o(*￣▽￣*)ブ</p>
        </div>
    </div>
    <div class="row mt">
        <div class="col-lg-8 col-lg-offset-2">

            <!-- +++++ 表单录入部分 +++++ -->
            <form id="contactForm" method="post" action="/contact/add">
                <div class="form-group">
                    <input name="name" type="text" class="form-control" placeholder="姓　名"><br>
                </div>
                <div class="form-group">
                    <input name="email" type="text" class="form-control" placeholder="邮　箱"><br>
                </div>
                <div class="form-group">
                    <input name="title" type="text" class="form-control" placeholder="标　题"><br>
                </div>
                <div class="form-group">
                    <textarea name="content" rows="6" class="form-control" placeholder="正　文"></textarea><br>
                </div>
                <div class="form-group">
                    <button type="submit" value="submit" class="btn btn-danger">提交</button>
                </div>
            </form>

        </div>
    </div><!-- /row -->
</div><!-- /container -->
</div>

<!-- +++++ 表单验证部分 +++++ -->
<script>
    $().ready(function() {
        // 在键盘按下并释放及提交后验证提交表单
        $("#contactForm").validate({
            errorElement: "span",
            errorClass: "fa fa-exclamation-circle",
            rules: {
                name: "required",
                email: {
                    required: true,
                    email: true
                },
                title: {
                    required: true,
                    maxlength: 5
                },
                content: {
                    required: true,
                    maxlength: 300
                }
            },
            messages: {
                name: " 请输入姓名",
                email: " 请输入正确的邮箱",
                title: {
                    required: " 请输入标题",
                    maxlength: " 标题不得超过25字"
                },
                content: {
                    required: " 请输入正文",
                    maxlength: " 正文不得超过300字"
                }
            }
        });
    })
</script>